<?php
namespace app\controller\v1\api;

use app\BaseController;
use app\common\Send;
use think\App;
use think\Request;
use app\service\AliSms;
use app\service\CodeService;
use app\validate\Member as MemberValidate;
class Sms extends BaseController
{
    use Send;
    private $AliSms;

    private $codeService;
    public function __construct(App $app,CodeService $codeService){
        parent::__construct($app);

        $this->codeService = $codeService;
    }
    public function getCode(Request $request)
    {
        $code = $this->codeService->getCode();
        $phone = $request->param('phone');
        $this->codeService->setCode($phone,$code);
        (new AliSms)->sendSms($phone,$code,'ali');
        return self::success($code);
    }

}
